<template>
    <a-modal
            title="添加企业"
            :visible="visible"
            width="1200px"
            @ok="handleOk"
            :confirmLoading="confirmLoading"
            @cancel="handleCancel"
    >
        <a-form-model ref="form" :model="form">
            <a-descriptions bordered :column="2">
                <a-descriptions-item label="团队名称" span="2">
                    <a-form-model-item
                            prop="teamName"
                            :rules="{
                                required: true,
                                message: '请输入团队名称',
                                trigger: 'change',
                            }">
                        <a-input
                                :maxLength="100"
                                :placeholder="'请输入团队名称'"
                                v-model="form.teamName">
                        </a-input>
                    </a-form-model-item>
                </a-descriptions-item>
                <a-descriptions-item label="选择入驻时间" span="2">
                    <a-form-model-item
                            prop="joinDate"
                            :rules="{
                                required: true,
                                message: '请选择入驻时间',
                                trigger: 'change',
                            }">
                        <xlDate
                                :placeholder="'请选择入驻时间'"
                                v-model="form.joinDate">
                        </xlDate>
                    </a-form-model-item>
                </a-descriptions-item>
                <a-descriptions-item label="行业领域" span="2">
                    <a-input
                            :placeholder="'请输入行业领域'"
                            v-model="form.industryDomain">
                    </a-input>
                </a-descriptions-item>

            </a-descriptions>
        </a-form-model>
    </a-modal>
</template>

<script>
    import xlDate from '@/components/formUntil/xlDate'
    import {carrierTeamInfoAdd} from "@/assets/api";

    export default {
        name: "xlForm",
        data() {
            return {
                tableTitle: '编辑',
                visible: false,
                confirmLoading: false,
                form: {},
                rules: {}
            }
        },
        components: {
            xlDate
        },
        methods: {
            handleOk() {
                this.$refs.form.validate(valid => {
                    if (valid) {
                        this.confirmLoading = true
                        carrierTeamInfoAdd({
                            param: this.form
                        })
                            .then(result => {
                                this.confirmLoading = false
                                this.visible = false
                                this.$message.success('操作成功')
                                this.$emit('editForm', result.result)
                            })
                    } else {
                        console.log('error submit!!');
                        return false;
                    }
                });
            },
            handleCancel() {
                this.visible = false
            },
            formatData() {

            },
            formatForm(form) {
                delete form.createDateTime
                delete form.modifyDateTime
                delete form.modifyBy
                delete form.createBy
                //整理字段数据 ／ 赋值 清空等
                this.form = Object.assign({}, form)

            }
        }
    }
</script>

<style scoped lang="less">
    /deep/ .ant-form-item {
        margin: 0;
    }

    /deep/ .ant-input-number {
        width: 100%;
    }

    .xl-dateRange {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .ant-checkbox-group {
        display: flex;
        flex-wrap: wrap;

        .xl-checkbox {
            display: flex;
            align-items: center;

            /deep/ span:nth-child(2):not(.ant-checkbox-inner) {
                display: flex;
                justify-content: space-between;
                white-space: pre;
            }
        }
    }
</style>
